/*
 * @Author: your name
 * @Date: 2022-04-26 15:47:03
 * @LastEditTime: 2022-04-27 09:48:48
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vite\src\commom\api.ts
 */
interface foodType {
    id:string;
    title:string;
    price:number;
    nums:number;
}

const foods:Array<foodType> = [
    { id: 'husky', title: '小猪佩奇', price: 50, nums: 10 },
  { id: 'car', title: '飞行玩具车', price: 10, nums: 15 },
  { id: 'milk', title: '牛奶奶糖', price: 30, nums: 5 }
]

const loadFood =()=>{
    return new Promise((resolve)=>{

      resolve(foods);

    })
}

const getFood=async(): Promise<any>=> {
    let [foods] = await Promise.all([loadFood()]);
    return foods
}
export default getFood